<template>
  <n-modal :show="state.dialogFormVisible" @onUpdateShow="close">
    <div class="cancel-dia">
      <div class="nav">
        <div class="title">确认提示</div>
        <div class="close" @click="close">
          <i class="esayIcon esayIcon-youjiantou"></i>
        </div>
      </div>
      <div class="desc">{{ title }}</div>
      <div class="tool flex">
        <n-button class="btn" @click="close">取消</n-button>
        <n-button class="btn confirm-btn" type="primary" @click="handConfirm">
          确定
        </n-button>
      </div>
    </div>
  </n-modal>
</template>
<script setup lang="ts">
import { NButton, NModal } from 'naive-ui'
import { reactive } from 'vue'
type PropsState = {
  title: string
}
withDefaults(defineProps<PropsState>(), {
  title: ''
})
const emit = defineEmits(['confirm'])
const state = reactive({
  dialogFormVisible: false
})
const handConfirm = () => {
  emit('confirm')
  close()
}
const close = () => {
  state.dialogFormVisible = false
}
const open = () => {
  state.dialogFormVisible = true
}
defineExpose({
  open
})
</script>

<style scoped lang="scss">
.cancel-dia {
  width: 408px;
  background: #fff;
  border-radius: 15px;
  box-sizing: border-box;
  padding: 24px;
  .nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 23px;
    .title {
      font-size: 20px;
      font-weight: bold;
      color: #333333;
    }
    .close {
      cursor: pointer;
      i {
        font-size: 24px;
        color: #666666;
      }
    }
  }
  .desc {
    padding-top: 43px;
    font-size: 16px;
    font-weight: 400;
    color: #333333;
    text-align: center;
  }
  .tool {
    margin-top: 58px;
    justify-content: center;
    .btn {
      width: 124px;
      height: 40px;
    }
    .confirm-btn {
      margin-left: 24px;
    }
  }
}
</style>
